//home模块小仓库
import { reqClassList, reqGetBannerList} from "@/api";
const state = {
    //state默认初始值取决于接口返回值
    classList:[],
    bannerList:[],
    floorList:[],
};
const mutations = {
    CLASSLIST(state, classList) {
        state.classList = classList;
    },
    GETBANNERLIST(state, bannerList) {
        state.bannerList = bannerList;
    },
    GETFLOORLIST(state, floorList) {
        state.floorList = floorList;
    },
};
const actions = {
    //获取二级分类数据
    async classList({ commit }) {
        let result = await reqClassList();
        if (result.code == 200) {
            commit("CLASSLIST", result.data)
        }
    },
    //获取轮播图的数据（目前没用）
    async getBannerList({ commit }) {
        let result = await reqGetBannerList();
        if (result.code == 200) {
            commit('GETBANNERLIST', result.data);
        }
    },
};
const getters = {};
export default {
    state,
    mutations,
    actions,
    getters
}